from flask import Flask
from ..model.book import db


def create_app():
    app = Flask(__name__,static_folder='../../View/static',template_folder='../../View/templates')
    app.config.from_object('config.app')
    app.config.from_object('config.book')
    app.config.from_object('config.database')
    registe_blueprints_web(app)
    registe_blueprints_api(app)
    return app


def registe_blueprints_web(app):
    from .web import web

    app.register_blueprint(web)


def registe_blueprints_api(app):
    from .api import api

    app.register_blueprint(api)
